package net.niufei.decoder;

import net.niufei.DataBuffer;
import net.niufei.Packet;
import net.niufei.PacketDecoder;
import net.niufei.Session;
import net.niufei.buffer.DataBufferFactory;
import net.niufei.packet.DefaultPacket;

public class SimplePacketDecoder implements PacketDecoder {

	@Override
	public Object decode(Session session, Packet packet) throws Exception {
		DataBuffer content = packet.getContent();
		return new DefaultPacket(DataBufferFactory
				.allocate(content.remaining()).put(content),
				packet.getAddress());
	}

}
